package com.huishu.user.controller;


import com.huishu.commons.pojo.BasePage;
import com.huishu.commons.pojo.Result;
import com.huishu.user.pojo.dto.ActivityPageCreateDTO;
import com.huishu.user.pojo.dto.ActivityPageUpdateDTO;
import com.huishu.user.service.ActivityPageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author generator@ljj
 * @since 2023-06-19
 */
@Slf4j
@RestController
@RequestMapping("/activity-page")
public class ActivityPageController {

    @Autowired
    private ActivityPageService activityPageService;

    @PostMapping("/pageList")
    public Result pageList(@RequestBody BasePage basePage) {
        return activityPageService.pageList(basePage);
    }

    @PostMapping("/create")
    public Result create(@RequestBody ActivityPageCreateDTO activityPageCreateDTO) {
        return activityPageService.create(activityPageCreateDTO);
    }

    @PostMapping("/update")
    public Result modify(@RequestBody ActivityPageUpdateDTO activityPageUpdateDTO) {
        return activityPageService.modify(activityPageUpdateDTO);
    }

    @PostMapping("/disableOrOpen")
    public Result disableOrOpen(@RequestBody ActivityPageUpdateDTO activityPageUpdateDTO) {
        return activityPageService.disableOrOpen(activityPageUpdateDTO);
    }

    @GetMapping("/findById/{id}")
    public Result findById(@PathVariable Long id) {
        return activityPageService.findById(id);
    }

    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Long id) {
        return activityPageService.delete(id);
    }

    @GetMapping("/generateQrCode/{id}")
    public Result<String> generateQrCode(@PathVariable Long id) {
        return activityPageService.generateQrCode(id);
    }
}
